﻿@using GP.Logic.Model
@model ICollection<Doctor>
@{
    ViewBag.Title = "Doctors";
}

<h2>Doctors</h2>

@Html.ActionLink("Create new doctor", MVC.Doctor.Create())

<table>
    <tr>
        <th>
            DocId
        </th>
        <th>
            Name
        </th>
        <th>
            LicensNr
        </th>
        <th>
            Email
        </th>
        <th>
            Phone
        </th>
        <th></th>
        <th></th>
    </tr>
    @foreach(var item in Model)
    {
        <tr>
            <td>@item.DocId</td>
            <td>@item.Name</td>
            <td>@item.LicensNr</td>
            <td>@item.Email</td>
            <td>@item.Phone</td>
            <td>@Html.ActionLink("Edit", MVC.Doctor.Edit(item.DocId))</td>
            <td>
                @if (item.Citizens.Count == 0 && item.GpSysUsers.Count == 0)
                { 
                    @Html.ActionLink("Delete", MVC.Doctor.Delete(item.DocId))
                }
            </td>
        </tr>
    }
</table>

